import 'package:get/get.dart';
import 'package:hc_bot_pro/common/service/channel/channel.dart';

import '../common/model/chat/chat.dart';
import '../common/service/chat/chat.dart';

enum HCAIBotStatus { idle, listening, speaking, thinking, sleeping }

class ChatState {
  HCAIBotStatus status = HCAIBotStatus.idle;

  //chat
  final List<ChatModel> _chatList = [];

  String _conversationID = "";

  String get conversationID => _conversationID;

  List<ChatModel> get chatList => _chatList;

  Future reset() async {
    _conversationID = Get.find<ChatService>().genenrateConversationId();
    _chatList.clear();
  }

  //
  String get welcomeMessage => Get.find<ChannelService>().welcomePhase;

  final String qrTip = """
  您可以扫描屏幕上的二维码，将音频疗愈带回家，随时随地都能使用。
  """;

  String get stateTip {
    switch (status) {
      case HCAIBotStatus.sleeping:
        return "请说“你好小惠”";
      case HCAIBotStatus.thinking:
        return "我正在思考，请稍后";
      default:
        break;
    }
    return "我在听，请讲";
  }
}

extension ChatStateExtension on ChatState {
  bool get isThinking => status == HCAIBotStatus.thinking;

  bool get isSpeaking => status == HCAIBotStatus.speaking;

  bool get isSleeping => status == HCAIBotStatus.sleeping;
}
